﻿#region Using Statements
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.GamerServices;
using System.ComponentModel;
#endregion

namespace TunnelsOfDeath
{
    partial class Game1 : Game
    {

        protected double LevelLostTimer = 0; 

        protected void MainStateLevelLost(GameTime _gt)
        {

            if (Globals.Gui.ShouldDrawMap)
            {
                UpdateTick(_gt);
                UpdateMap(_gt);
            }

            if (LevelLostTimer == 0)
            {
                LevelLostTimer = _gt.TotalGameTime.TotalMilliseconds + 2000;
            }
            else
            {

                if (LevelLostTimer < _gt.TotalGameTime.TotalMilliseconds)
                {
                    Globals.Animated.Clear();
                    Globals.PositionUpdate.Clear();
                    Globals.ActivePlayersOnMap.Clear();
                    Globals.MyMapManager.LoadMap(Globals.CurrentMapName);
                    Globals.StateManager.ChangeState(GameState.game);
                    Globals.MyCameraManager.FindAssignPlayers();
                    MainTimer = _gt.TotalGameTime.TotalMilliseconds + 2000;
                    LevelLostTimer = 0;
                }



            }



        }
    }

}
